<html>
 <head>
    <title>[var.TITLE]</title>
    <link href="[var.ROOT_CSS_DIR]/main.css" rel="STYLESHEET" type="text/css" charset="iso-8859-1" hreflang="en-us">
    <link href="[var.ROOT_CSS_DIR]/facet/style.css" rel="STYLESHEET" type="text/css" charset="iso-8859-1" hreflang="en-us">
    <script type="text/javascript" src="[var.ROOT_DIR]js/common.js"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/doiMenuDOM.js"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/functions.js"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/jsmenu.php"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/jsmenu.cfg"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/jsformgrid.php?session=[var.SessionVar]"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/jsmasks.js"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/jsverify.php?session=[var.SessionVar]"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/jsinit.php?session=[var.SessionVar]"></script>
    <script type="text/javascript" src="[var.ROOT_DIR]js/jquery.min.js"></script>
 </head>
 <body bgcolor="FFFFFF" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0"> 
    <table border="0" cellspacing="0" cellpadding="0" width="100%" align="[var.POSITION]">
        <tr>
            <td>[tbs_include.onshow;file=[var.HTMLHeader];getob;]</td>
        </tr>
        <tr>
            <td>
            <table border="0" cellspacing="0" cellpadding="0" width="100%">
                <tr>
                    <td class="mainmenu2"><img src="images/spacer.gif" height="1" width="1"></td>
                </tr>
                <tr>
                    <td background="[var.ROOT_IMG_DIR]/back-menu.gif">
                    <table border="0" cellspacing="0" cellpadding="0" width="100%">
                        <tr>
                            <td>
                                <script language="JavaScript" type="text/JavaScript">menu.Build();</script>
                          </td>
                          <td class="head-login">Login as [var.USERPROFILE_NAME]</td>
                        </tr>
                      </table>
                    </td>
                </tr>

                <tr>
                    <td class="mainmenu2"><img src="images/spacer.gif" height="1" width="1"></td>
                </tr>
            </table>
            </td>
        </tr>
        <tr height="100%">
            <td>
            <table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">
                <tr valign="top">
                    <td width="100%">
                        <table border="0" cellspacing="0" cellpadding="0" width="100%">
                            <tr>
                                <td class="head-path"></td>
                                <td class="corner-date">[var.CORNER_DATE]</td>
                            </tr>
                        </table>
                        <table border="0" cellspacing="0" cellpadding="5" width="100%">
                            <tr>
                                <td class="FacetHeaderContent" >.:[var.SubHeaderTitle]:.</td>
                            </tr>
                        </table>

                        <table border="0" cellspacing="0" cellpadding="5" width="100%">
                            <tr>
                                <td class="contentTitle">
                                Menu
                                </td>
                            </tr>
                            <tr>
                                <td class="content2">
                                <table cellspacing="2" cellpadding="0">
                                 <tr>
                                   <td>
                                     <input type="button" name="Action" value="<<Back" class="button" onClick="self.location.replace('[sys.script_name]')">
                                   </td>
                                   <td>
									 <input type="button" name="Action" value="Print to PDF" class="button" onClick="return SubmitPDF();">
								   </td>
                                   <td>
                                     <input type="button" name="Action" value="Done" class="button" onClick="self.location.replace('[var.SERVER_URL]')">
                                   </td>
                                 </tr>
                                </table>
                                </td>
                            </tr>
                            <tr>
                                <td class="content2">
                         
                         <!--TABLE MASTER-->       
						 <table width="1400">
							 <tr>
								 <td width="50%" valign="top"> 
                                
                        <!-- FORM SECTION -->
                        <table border="0" cellspacing="0" cellpadding="0">

                        <form method="post" action="[var.FormAction]" name="[var.HTMLFormName]" >
                              <tr>
                                <td class="fieldCaption" align="right">Job Order Code</td>
                                <td class="fieldCaption">:</td>
                                <td class="fieldCaption">
                                     <div style="font-weight:bold;font-size:13px;">[headblv.jo_code;noerr]</div> 
                                </td>                                
                              </tr>
                              <tr>
                                <td class="fieldCaption" align="right">Document Reference</td>
                                <td class="fieldCaption">:</td>
                                <td class="fieldCaption">                                    
                                     [headblv.doc_ref;noerr]
                                </td>
                                
                              </tr>
                              <tr>
                                <td class="fieldCaption" align="right">Project Name</td>
                                <td class="fieldCaption">:</td>
                                <td class="fieldCaption">
                                   [headblv.project_name]
                                </td>
                              </tr>
                              <tr>
                                <td class="fieldCaption" align="right">Customer</td>
                                <td class="fieldCaption">:</td>
                                <td class="fieldCaption">
                                   [headblv.CUNAME;noerr]
                                </td>
                              </tr>
                              <tr>
                                <td class="fieldCaption" align="right">Staff</td>
                                <td class="fieldCaption">:</td>
                                <td class="fieldCaption">                                   
									[headblv.nama;noerr]
                                </td>
                              </tr>
                              <tr>
                                <td class="fieldCaption" align="right">Job Order Date</td>
                                <td class="fieldCaption">:</td>
                                <td class="fieldCaption">
                                    [headblv.jo_date;frm='dd/mm/yyyy';noerr]
                                </td>
                              </tr>
                              <tr>
                                <td class="fieldCaption" align="right">BL no.</td>
                                <td class="fieldCaption">:</td>
                                <td class="fieldCaption">                                    
                                     [headblv.bl_no;noerr]
                                </td>
                                
                              </tr>
                              <tr>
                                <td class="fieldCaption" align="right">Invoice no.</td>
                                <td class="fieldCaption">:</td>
                                <td class="fieldCaption">                                    
                                     [headblv.invoice_no;noerr]
                                </td>                                
                              </tr>
                              <tr>
                                <td class="fieldCaption" align="right">Vessel</td>
                                <td class="fieldCaption">:</td>
                                <td class="fieldCaption">                                    
                                     [headblv.vessel;noerr]
                                </td>
                                
                              </tr>
                              <tr>
                                <td class="fieldCaption" align="right">Approval Status</td>
                                <td class="fieldCaption">:</td>
                                <td class="fieldCaption">
                                   [headblv.approval_status]
                                </td>
                              </tr>


                         </table>
                         <!-- END FORM SECTION -->
                         
                         
                         
                         
                         <!--CARGO-->
                             
						 <h3>DATA CARGO</h3>
						 
						 <div style="overflow:auto;height:200px;">
						 <table border="0" width="600px" cellpadding="3" cellspacing="1" class="FacetFormTABLE" align="left">

							<tr>                                       
									<td nowrap class="FacetColumnTD" align="center" width="35">No.</td>
									<td nowrap class="FacetColumnTD" align="center" width="150">Cargo Type</td>
									<td nowrap class="FacetColumnTD" align="center" width="40">Qty</td>
									<td nowrap class="FacetColumnTD" align="center" width="70">Weight (kg)</td>
									<td nowrap class="FacetColumnTD" align="center" width="70">Volume (cbm)</td>
									<td nowrap class="FacetColumnTD" align="center">Remarks</td>
							</tr>
							
							<tr id="rowCargo[blgCargo.#]" style="display:[blgCargo._display;noerr]">
															
								<td nowrap class="FacetDataTD" align="right" align="right">
								  [blgCargo.#;block=tr].
								  <input type="hidden" name="jo_id[blgCargo.#]" value="[tbs_check;if [var.jo_id;noerr]!='';then [var.jo_id;noerr] ;else '']">
								</td>
																										
																	
								<td nowrap class="FacetColumnTD" align="center">
								   <select name="cargo_type[blgCargo.#]" id="input" disabled>
									 <option value="">-</option>
									 <option value="[CargoType.cargo_id]">[CargoType.cargo_name;block=option]</option>
									 <option>[blgCargo.cargo_type;selected;noerr]</option>
								   </select>
								</td>
								
								<td nowrap class="FacetColumnTD" align="center">
								  <input type="text"  name="cargo_jumlah[blgCargo.#]" value="[blgCargo.cargo_jumlah;noerr]" id="input" size="4" disabled>
								</td>
								
								<td nowrap class="FacetColumnTD" align="center">
								  <input type="text"  name="cargo_berat[blgCargo.#]" value="[blgCargo.cargo_berat;noerr]" id="input" size="7" disabled>
								</td>
								
								<td nowrap class="FacetColumnTD" align="center">
								  <input type="text"  name="cargo_volume[blgCargo.#]" value="[blgCargo.cargo_volume;noerr]" id="input" size="7" disabled>
								</td>
								
								<td nowrap class="FacetColumnTD" align="center">
								  <input type="text"  name="cargo_lamp[blgCargo.#]" value="[blgCargo.cargo_lamp;noerr]" id="input" size="20" disabled>
								</td>
								
							
							</tr>
							
						 </table>
						 </div>
						 
						 <br>
						 
													  
						 
						 <!--END CARGO-->
                         
                         
                         
                         
                         
                         </td>
                         
                         <td valign="top">
                                                      
                             <!--DATA CARGO-->
                             
                             
                             <!--Canvas-->
							 <table>
							 
							                             
                            
                            <!--Canvas 1-->
                             
                             <tr>
                                <td>
                             
                              
                             <h3>REVENUE</h3>
                             
                             <!--Revenue-->
                             <table border="0" width="60%" cellpadding="3" cellspacing="1" class="FacetFormTABLE" align="left" style="margin-bottom:20px;">
                                
                                <tr>
									<td nowrap class="FacetColumnTD" align="center" width="100">Currency</td>
									<td nowrap class="FacetColumnTD" align="center" width="175">Revenue Before Tax (RBT)</td>
									<td nowrap class="FacetColumnTD" align="center">Revenue After Tax (RAT)</td>
								</tr>
								<tr>
									<td nowrap class="FacetColumnTD" align="center">IDR </td>
									<td nowrap class="FacetDataTD" align="center"><input type="text" name="rbt_idr" value="[headblv.rbt_idr;noerr;frm='0,000.00']" size="23" class="input" disabled></td>
									<td nowrap class="FacetDataTD" align="center"><input type="text" name="rat_idr" value="[headblv.rat_idr;noerr;frm='0,000.00']" size="23" class="input" disabled></td>
								</tr>
								<tr>
									<td nowrap class="FacetColumnTD" align="center">USD </td>
									<td nowrap class="FacetDataTD" align="center"><input type="text" name="rbt_usd" value="[headblv.rbt_usd;noerr;frm='0,000.00']" size="23" class="input" disabled></td>
									<td nowrap class="FacetDataTD" align="center"><input type="text" name="rat_usd" value="[headblv.rat_usd;noerr;frm='0,000.00']" size="23" class="input" disabled></td>
								</tr>
                                
                             </table>
                                                                                    
                             <!--End Revenue-->
                           
                             
                              <!--End Canvas 1-->
                             </td>
                           
                           </tr>
                            
                           </table> 
                             
                         
                         </td>
                         
						 </tr>
						 </table>       
                         
                         <!--END TABLE MASTER-->
                         
                                </td>
                            </tr>
                        </table>


                        <!--GRID-->

                        <hr size="1" color="DFDFDF">
                        <div id="spanHeader" style="height: 25px; vertical-align: top; overflow-y: noscroll;">
                        <table border="0" width="100%" cellpadding="3" cellspacing="1" class="FacetFormTABLE" align="left">

                                <tr>
                                        <td nowrap class="FacetColumnTD" align="center" width="35">No.</td>
										<td nowrap class="FacetColumnTD" align="center" width="230">Services</td>
                                        <td nowrap class="FacetColumnTD" align="center" width="50">Qty</td>
                                        <td nowrap class="FacetColumnTD" align="center" width="100">Unit</td>
                                        <td nowrap class="FacetColumnTD" align="center" width="65">Currency</td>
                                        <td nowrap class="FacetColumnTD" align="center" width="100">Rate</td>
                                        <td nowrap class="FacetColumnTD" align="center" width="110">Amount</td>
                                        <td nowrap class="FacetColumnTD" align="center" width="110">Base Amount</td>
                                        <td nowrap class="FacetColumnTD" align="center" width="155">Tax Rate</td>
                                        <td nowrap class="FacetColumnTD" align="center" width="100">Tax Amount</td>
                                        <td nowrap class="FacetColumnTD" align="center" width="130">Total Amount</td>
                                        <td nowrap class="FacetColumnTD" align="center">Create Billing</td>
                                </tr>
                        </table>
                        </div>




                        <div id="spanDetail" class="tariffgrid" style="height: 200px; vertical-align: top; overflow: auto;">

                            <!--Edited by van Smith-->

                            <table border="0" width="100%" cellpadding="3" cellspacing="1" class="FacetFormTABLE" align="left">

                                <tr id="[blg.#]" style="display:[blg._display;noerr]">
                                                                               
                                        <td nowrap class="FacetDataTD" align="right" width="35" align="right">
                                          [blg.#;block=tr]. 
                                          <input type="hidden" name="jo_id[blg.#]" value="[tbs_check;if [var.jo_id;noerr]!='';then [var.jo_id;noerr] ;else '']">
                                        </td>
                                                                                 
                                        <td nowrap class="FacetColumnTD" align="center" width="230">
                                          										  
                                           <select name="debturList[blg.#]" id="input" onchange="GetServices(this.value,'[blg.#]');" disabled>
											 <option value="" selected>Services</option>
											 <option value="1">Select</option>
										   </select>
										   <input type="hidden" name="services_id[blg.#]" value="[blg.services_id;noerr]" class="input">
										   <input type="hidden" name="services_code[blg.#]" value="[blg.services_code;noerr]" class="input">
										   <input type="text" name="services_name[blg.#]" value="[blg.services_name;noerr]" maxlength="255" size="20" class="input" disabled>
                                        </td>
                                        
                                        <td nowrap class="FacetColumnTD" align="center" width="50"><input type="text"  name="qty[blg.#]" value="[blg.qty;noerr]" id="input" class="gridBox" onkeyup="getBaseAmount('[blg.#]')" size="5" disabled></td>
                                        <td nowrap class="FacetColumnTD" align="center" width="100">
                                           <select name="unit[blg.#]" class="input" disabled>
											 <option value="">-</option>
											 <option value="[unit.unit_code]">[unit.unit_name;block=option]</option>
											 <option>[blg.unit;selected;noerr]</option>
										   </select>
                                        </td>
                                        <td nowrap class="FacetColumnTD" align="center" width="65">
                                          
                                           <select name="curr[blg.#]" id="input" onchange="getBaseAmount('[blg.#]')" disabled>
                                              <option value="">-</option>
                                              <option value="IDR">IDR</option>
                                              <option value="USD">USD</option>
                                              <option>[blg.curr;selected;noerr]</option>
                                           </select>
                                        </td>
                                        <td nowrap class="FacetColumnTD" align="center" width="100"><input type="text"  name="rate[blg.#]" value="[blg.rate;noerr;frm='0,000.00']" id="input" onkeyup="getBaseAmount('[blg.#]')" size="12" disabled></td>
                                        <td nowrap class="FacetColumnTD" align="center" width="110"><input type="text"  name="amount[blg.#]" value="[blg.amount;noerr;frm='0,000.00']" id="input" size="14" readonly class="amount" disabled></td>
                                        <td nowrap class="FacetColumnTD" align="center" width="110"><input type="text"  name="base_amount[blg.#]" value="[blg.base_amount;noerr;frm='0,000.00']" id="input" size="14" disabled></td>
                                        <td nowrap class="FacetColumnTD" align="center" width="155">
                                           
                                           <select name="tax_rate[blg.#]" class="input" disabled>
											 <option value="">-</option>
											 <option value="[taxRate.calculate]-[taxRate.tax_kind]">[taxRate.description;block=option]</option>
											 <option>[blg.tax_rate;selected;noerr]</option>
										   </select>
										   
                                        </td>
                                        <td nowrap class="FacetColumnTD" align="center" width="100"><input type="text"  name="tax_amount[blg.#]" value="[blg.tax_amount;noerr;frm='0,000.00']" id="input" size="12" disabled></td>
                                        <td nowrap class="FacetColumnTD" align="center" width="130"><input type="text"  name="total_amount[blg.#]" value="[blg.total_amount;noerr;frm='0,000.00']" id="input" size="16" disabled></td>
                                        <td nowrap class="FacetColumnTD" align="center">                                           
                                            <select name="payment_status_id[blg.#]" class="input" disabled>
											 <option value="">-</option>
											 <option value="[paymentStatus.payment_status_id]">[paymentStatus.payment_status_name;block=option]</option>
											 <option>[blg.payment_status_id;selected;noerr]</option>
										   </select>
                                        </td>


                                    </tr>
                            </table>

                            <!--End Edited by van Smith-->

                        </div>

                        <!--END GRID-->


                        <!--BUTTON-->
                        <div id="spanButton" style="height: 35px; vertical-align: top; overflow-y: noscroll;">
                        <table border="0" width="100%" cellpadding="3" cellspacing="1" class="FacetFormTABLE" align="left">
                                <tr>
                                    <td align="right" class="FacetColumnTD">

                                           <table border="0" cellspacing="2" cellpadding="0">
                                                   <tr>                                                         
                                                         <td>
                                                           <input type="button" name="Action" value="<<Back" class="button" onClick="self.location.replace('[sys.script_name]')">
                                                         </td>
                                                   </tr>
                                           </table>


                                    </td>
                                        </td>
                                </tr>

                        </table>
                        </div>

                        <!--END BUTTON-->


                    </td>
                </tr>

                </form>

            </table>
            </td>
        </tr>
        <tr>
            <td>
            <br>
            <table border="0" cellspacing="0" cellpadding="0" width="100%">
                <tr>
                    <td class="footer1"><img src="images/spacer.gif" height="1" width="1"></td>
                </tr>
                <!--tr>
                    <td class="footer2">Prototype Test - Web Application</td>
                </tr-->
            </table>
            </td>
        </tr>
    </table>
 </body>


 <iframe width="174" height="189" name="gToday:normal:agenda.js" id="gToday:normal:agenda.js" src="[var.ROOT_DIR]js/Calendar/pop/ipopeng.htm" scrolling="no" frameborder="0" style="LEFT: -500px; POSITION: absolute; TOP: 0px; VISIBILITY: visible; Z-INDEX: 999"></iframe>

 <script>
 [var.InitFunction]


 SetDK(1,'K');
 document.[var.HTMLFormName].total_trans.value = SumTotal("jumlah");

 function SetDK(idx,val) {
   //eval("dk = document.[var.HTMLFormName].dk"+idx+".value;");
   //if (dk=='') eval("document.[var.HTMLFormName].dk"+idx+".value='"+val+"';");
   return true;
 }
 

function IsNumeric(sText)
{
   var ValidChars = "0123456789.,";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
}


function SubmitPDF() {	
	  str_url = '[sys.script_name]?PageMode=PDF&jo_id=[var.jo_id]';
	  OpenPDF(str_url);
	  return false;	
}



function getBaseAmount(urut){

   oMask = new Mask('#,###.#0', 'number');

   var qty = eval("document.[var.HTMLFormName].qty"+urut+".value");
   var rate = eval("document.[var.HTMLFormName].rate"+urut+".value");
   var curr = eval("document.[var.HTMLFormName].curr"+urut+".value");
   var tax_rate = eval("document.[var.HTMLFormName].tax_rate"+urut+".value");

   var rbt_idr = 0;
   var rbt_usd = 0;
   var rat_idr = 0;
   var rat_usd = 0;

   var amountCounter = 0;
   var totalAmountCounter = 0;
   var currCounter = "";
   var counter = "";
   var n = 0;
   var reccount = 0;
   var amount = 0;
   var baseAmount = 0;
   var tax_amount = 0;
   var total_amount = 0;

   var dev_after_tax = 0;
   var mul_after_tax = 0;
   var nibt = 0;
   var niat = 0;

   //Parse the Tax
   var tax_arr = tax_rate.split("-");

   var tax_val = parseFloat(tax_arr[0]);
   var tax_text = tax_arr[1];
   //End Parse the Tax


   //error handling for rate
   if(rate == "") rate = 0;
   else if (!IsNumeric(rate)) alert('Rate should be Numeric value');

   //error handling for Quantity
   if(qty == "") qty = 0;
   else if (!IsNumeric(qty)) alert('Quantity should be Numeric value');

   //error handling for Tax Rate
   if(tax_rate == "") tax_rate = 0;

   //Parse to Integer
   //qty = parseInt(qty);
   //rate = parseInt(rate);

   if(curr == "IDR")
   {
      rate = String(rate);
      rate = (rate.replace(/,/g, "")) * 1;

      baseAmount = qty * rate;
      amount = qty * rate;
   }

   else if(curr == "USD")
   {
      rate = String(rate);
      rate = (rate.replace(/,/g, "")) * 1;

      baseAmount = qty * rate * [var.kursUSD];
      amount = qty * rate * [var.kursUSD];
   }


   //Counting the Total and Tax

   if(tax_text == "exclude")
   {
     baseAmount = String(baseAmount);
     baseAmount = (baseAmount.replace(/,/g, "")) * 1;
     tax_amount = baseAmount * tax_val;

     tax_amount = String(tax_amount);
     tax_amount = (tax_amount.replace(/,/g, "")) * 1;
     total_amount = baseAmount + tax_amount;
   }

   else if(tax_text == "include")
   {
     amount = String(amount);
     amount = (amount.replace(/,/g, "")) * 1;

     tax_amount = 0.1/(1.1 - tax_val) * amount;
     tax_amount = tax_amount.toFixed(2);
     total_amount = baseAmount;
   }

   //Not Visible on front end

   if(curr == "IDR")
   {
      dev_after_tax = amount - tax_amount;
      mul_after_tax = rate * tax_val;
      nibt = dev_after_tax + mul_after_tax;
      niat = dev_after_tax + mul_after_tax + tax_amount;
   }

   else if(curr == "USD")
   {
      dev_after_tax = baseAmount - tax_amount;
      mul_after_tax = rate * tax_val * [var.kursUSD];
      nibt = dev_after_tax + mul_after_tax;
      niat = dev_after_tax + mul_after_tax + tax_amount;
   }



    //Change to Mask Format --Start--
    var maskBaseAmount = oMask.format(baseAmount);
    var maskAmount = oMask.format(amount);
    var maskTaxAmount = oMask.format(tax_amount);
    var maskTotalAmount = oMask.format(total_amount);
    //Change to Mask Format --End--


   /*
   eval("document.[var.HTMLFormName].base_amount"+urut+".value = "+baseAmount);
   eval("document.[var.HTMLFormName].amount"+urut+".value = "+amount);
   eval("document.[var.HTMLFormName].tax_amount"+urut+".value = "+tax_amount);
   eval("document.[var.HTMLFormName].total_amount"+urut+".value = "+total_amount);
   */

   $("input[name=base_amount"+urut+"]").val(maskBaseAmount);
   $("input[name=amount"+urut+"]").val(maskAmount);
   $("input[name=tax_amount"+urut+"]").val(maskTaxAmount);
   $("input[name=total_amount"+urut+"]").val(maskTotalAmount);

   //Hidden value Start (for financial accounting)
   eval("document.[var.HTMLFormName].dev_after_tax"+urut+".value = "+dev_after_tax);
   eval("document.[var.HTMLFormName].mul_after_tax"+urut+".value = "+mul_after_tax);
   eval("document.[var.HTMLFormName].nibt"+urut+".value = "+nibt);
   eval("document.[var.HTMLFormName].niat"+urut+".value = "+niat);
   //Hidden value End (for financial accounting)

   $(".amount:visible").each(function(n) {
       n = n+1;
       reccount = n;
       counter = this.name;
       counter = counter.substring(6);

       //Count The RBT and RAT

       eval("amountCounter = document.[var.HTMLFormName].amount"+counter+".value");
       eval("totalAmountCounter = document.[var.HTMLFormName].total_amount"+counter+".value");
       eval("currCounter = document.[var.HTMLFormName].curr"+counter+".value");


       if(currCounter == "IDR")
       {
          //amountCounter = parseInt(amountCounter);
          amountCounter = String(amountCounter);
          amountCounter = (amountCounter.replace(/,/g, "")) * 1;

          if((amountCounter != "") || (amountCounter != "NaN"))
          {
            rbt_idr+= amountCounter;
          }
          else
          {
            rbt_idr+= 0;
          }
       }

       else if(currCounter == "USD")
       {
          //amountCounter = parseInt(amountCounter);
          amountCounter = String(amountCounter);
          amountCounter = (amountCounter.replace(/,/g, "")) * 1;

          if((amountCounter != "") || (amountCounter != "NaN"))
          {
            rbt_usd+= amountCounter;
          }
          else
          {
            rbt_usd+= 0;
          }
       }

       if(totalAmountCounter != "")
       {
         //totalAmountCounter = parseInt(totalAmountCounter);
         totalAmountCounter = String(totalAmountCounter);
         totalAmountCounter = (totalAmountCounter.replace(/,/g, "")) * 1;

         rat_idr+= totalAmountCounter;
       }
       else
       {
         rat_idr+= 0;
       }

   });




   /*eval("document.[var.HTMLFormName].rbt_idr.value = "+rbt_idr);
   eval("document.[var.HTMLFormName].rbt_usd.value = "+rbt_usd);
   eval("document.[var.HTMLFormName].rat_idr.value = "+rat_idr);*/
   eval("document.[var.HTMLFormName].rat_usd.value = 0");

   //Change to Mask Format --Start--
   maskrbt_idr = oMask.format(rbt_idr);
   maskrbt_usd = oMask.format(rbt_usd);
   maskrat_idr = oMask.format(rat_idr);
   //Change to Mask Format --end--

   $("input[name=rbt_idr]").val(maskrbt_idr);
   $("input[name=rbt_usd]").val(maskrbt_usd);
   $("input[name=rat_idr]").val(maskrat_idr);

   //END Count The RBT and RAT


 }





 function GetServices(val,no_urut) {
      newwin = window.open("ais_transaction_serviceslist.php?FormName=[var.HTMLFormName]&no_urut="+no_urut,"toolcalc","height=400,width=640,noscroll,resizable");
 }
 
  function GetReceived(val,no_urut) {
      newwin = window.open("ais_transaction_custlist_2.php?FormName=[var.HTMLFormName]&no_urut="+no_urut,"toolcalc","height=400,width=640,noscroll,resizable");
 }

 function GetStaff(val,need_another_var) {
            newwin = window.open("ais_transaction_stafflist.php?FormName=[var.HTMLFormName]&need_another_var="+need_another_var,"toolcalc","height=400,width=640,noscroll,resizable");
 }


 function OpenPrincipal (number) {
        newwin = window.open("ais_transaction_receipt_entry.php?PageMode=Page2&FormName=[var.HTMLFormName]&Number="+number,"vessel","height=105,width=300,noscroll,noresizable");
 }

 function OpenRemark (number) {
        newwin = window.open("ais_transaction_dn.php?PageMode=Remark&FormName=[var.HTMLFormName]&Number="+number,"remarks","height=105,width=300,noscroll,noresizable");
 }

 function OpenPrint (number) {
        newwin = window.open("ais_transaction_dn.php?PageMode=PrintPreview&nobkt="+number,"print","height=650,width=600,noscroll,noresizable");
 }


 function GetSkada() {
         skada1 = document.[var.HTMLFormName].thbl.value;
         if (skada1.length) LoadRPC ("iLoader", "[var.FileName]", "thbl="+document.[var.HTMLFormName].thbl.value);
 }


 function GetTotal () {
         document.[var.HTMLFormName].total_trans.value = SumTotal("jumlah");
 }


 /* added by dyah <dyah.mahrani@gmail.com>
 * 23 juli 2009
 * desc: COA filter based on group <payable/receivable>
 * */


 function getCashType(){
    var frm = document.[var.HTMLFormName].cash_type;
    return frm.options[frm.selectedIndex].value;
 }

var reccount = 1;
//if (reccount==0) reccount=1; else reccount=5;
var last;

function AddFormGridProject (cname,firstelemen) {
    if (VerifyGridProject(reccount)==false) {
        return false
    }

    $(".gridBox:visible").each(function(n) {
        n = n+1;
        reccount = n;
    });

    //reccount = 5;
    reccount = parseInt(reccount)+1;

    //alert("reccount: " + reccount);

    if (reccount>=100) {
        cname.disabled = true;
    }

    var objrow = document.getElementById(reccount);

    if (objrow.style.display == 'none') {
        objrow.style.display = '';
    }

    eval(firstelemen+''+reccount+'.focus()');

    return false;
}



function AddFormGridCargo (cname,firstelemen) {
    if (VerifyGridCargo(reccount)==false) {
        return false
    }

    $(".gridBox2:visible").each(function(n) {
        n = n+1;
        reccount = n;
    });

    //reccount = 5;
    reccount = parseInt(reccount)+1;

    //alert("reccount: " + reccount);

    if (reccount>=100) {
        cname.disabled = true;
    }

    var objrow = document.getElementById("rowCargo"+reccount);

    if (objrow.style.display == 'none') {
        objrow.style.display = '';
    }

    eval(firstelemen+''+reccount+'.focus()');

    return false;
}




function VerifyGridProject (x) {
    err_message = '';
    last_focus =0;
    if (err_message.length) {//alert(err_message);
    return false} else return true
}

function VerifyGridCargo (x) {
    err_message = '';
    last_focus =0;
    if (err_message.length) {//alert(err_message);
    return false} else return true
}

function CheckAllGrid(firstelemen) {
        for (n=1;n<reccount;n++) {
                if (!VerifyGrid(n)) return false;
        }
        eval('fl = document.'+firstelemen+reccount+'.value');
        if (fl.length)
                if (!VerifyGrid(reccount)) return false;
return true;}

 function GetReceived(val) {

     var getProjectValue = document.getElementById('projectname').value;

    //alert(getProjectValue);

     switch (val){
        case "1":
            newwin = window.open("ais_transaction_custlist_2.php?FormName=[var.HTMLFormName]&SendToBack=1&PageMode=Test&ProjectId=" + getProjectValue ,"toolcalc","height=400,width=640,noscroll,resizable");
            break;
     }
 }

 </script>


</html>
